

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class SelectTable {
	public static void main(String args[]) throws Exception {
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn = DriverManager.getConnection
				("jdbc:oracle:thin:@127.0.0.1:1521:xe", "scott", "tiger");
		Statement stmt = conn.createStatement();
		ResultSet rs = stmt.executeQuery("select * from product");
		while(rs.next()) {
			System.out.print(rs.getString("id") + "  ");
			System.out.print(rs.getString("classid") + "  ");
			System.out.print(rs.getString("name") + "  ");
			System.out.print(rs.getInt("balance") + "  ");
			System.out.println(rs.getFloat("price"));
		}
		rs.close();
		stmt.close();
		conn.close();
	}
}
